package com.xxh.blog.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxh.blog.entity.Essay;
import com.xxh.blog.entity.vo.EssayDetailVo;
import com.xxh.blog.entity.vo.EssayVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("EssayDao")
public interface EssayDao extends BaseMapper<Essay> {
    int deleteByPrimaryKey(Long id);


    int insertSelective(Essay record);

    Essay selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Essay record);

    int updateByPrimaryKey(Essay record);


    /**
     *
     * @param page 分页组件
     * @param wrapper 条件构造器
     * @return
     */
    IPage<EssayVo> queryByCondition(Page page, @Param(Constants.WRAPPER)QueryWrapper<EssayVo> wrapper);

    EssayDetailVo getEssayDetail(Page page, @Param(Constants.WRAPPER)QueryWrapper<EssayDetailVo> wrapper);


}